package com.bitnei.battery.examples;

import com.bitnei.battery.bean.dataBean.replace.RepModule;
import com.bitnei.battery.bean.dataBean.replace.RepStorage;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: wang
 * @Date: 2019/10/16 10:08
 * @Version 1.0
 * Description: 换电入库示例
 */
public class ReplaceStoExample {

    public static void main(String[] args){
        //请求地址
        String url = "http://127.0.0.1:8999/bitnei/v1.0/battery/replaceBattery/batteryInStorage";
        //组装数据
        List<RepStorage> stoBatList = mockStoBat();
        //调用接口
        ApiUtilExample.callApi(url,stoBatList);
    }



    /**
     * 模拟换电入库数据
     * @return
     */
    private static List<RepStorage> mockStoBat(){
        List<RepStorage> stoBatList = new ArrayList<>();

        RepStorage stoBat = new RepStorage();
        stoBat.setCode("101PE00000");
        stoBat.setReplaceUnitCode("91430111MA4L16XXXX");
        stoBat.setReplaceUnitName("换电入库企业");
        stoBat.setModuleList(mockModule());
        return stoBatList;
    }


    /**
     * 模拟电池模块数据
     * @return
     */
    private static List<RepModule> mockModule(){
        List<RepModule> moduleList = new ArrayList<>();

        RepModule module = new RepModule();
        module.setCode("3TYNXH54J7DXUTK0BQZINW1H");
        List<String> cellList = new ArrayList<>();
        cellList.add("A66LPQTFZFJZKFK5O39F2M4I");
        module.setCellCodeList(cellList);
        moduleList.add(module);
        return moduleList;
    }
}
